System and method for distributed processing in COBOL

ABSTRACT

A system for enabling socket communication in COBOL program is provided. The system includes a memory block, a COBOL program communicating with the memory block, a socket and a COBOL routine callable from the COBOL program. The COBOL routine is operable to read information from the socket and write the information read from the socket to the memory block in response to the COBOL program call. A method for socket and pipe communication in COBOL is also provided. The method includes reading, by a routine, information from a socket or pipe and writing, by the routine, the information to an area. The method provides for reading, by a COBOL program, the information from the area. The COBOL program and the routine operating in the same runtime environment.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is related to U.S. patent application Ser. No. ______entitled SYSTEM AND METHOD FOR COBOL TO PROVIDE SHARED MEMORY AND MEMORYAND MESSAGE QUEUES, inventor Joseph G. Laura, filed on even dateherewith, U.S. patent application Ser. No. ______, entitled SYSTEM ANDMETHOD FOR ASYNCHRONOUS PROCESSING IN COBOL, inventor Joseph G. Laura,filed on even date herewith, and U.S. patent application Ser. No. ______entitled IMPLEMENTATION OF DISTRIBUTED AND ASYNCHRONOUS PROCESSING INCOBOL, inventor Joseph G. Laura, filed on even date herewith, all ofwhich are incorporated herein by reference for all purposes.

STATEMENT REGARDING FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT

Not applicable.

REFERENCE TO A MICROFICHE APPENDIX

Not applicable.

FIELD OF THE INVENTION

The present invention relates to the field of computer programs andcomputer programming languages and more specifically, but not by way oflimitation, to implementation of distributed and asynchronous processingin COBOL.

BACKGROUND OF THE INVENTION

Common Business Oriented Language, or COBOL as it is more commonlyknown, is a computer programming language that has been in use fordecades. COBOL is widely used for business applications on mainframecomputer systems. COBOL was created to address the needs of businesscomputing and is not generally used for writing system or low-levelprograms. COBOL applications can be hundreds of thousands or more linesof code that are used for years and evolve with periodic modificationsand maintenance. Due to the huge investment in these large, businesscritical, COBOL applications, it is difficult for businesses to justifyabandoning the COBOL applications for newer technologies.

Unfortunately, COBOL is severely limited in a number of areas comparedto the processing techniques available to developers that use otherlanguages such as C or JAVA. POSIX, or Portable Operating SystemInterface uniX, is a standard UNIX interface for applications to ensureinteroperability on equipment from various venders. POSIX includes wellknow functionality available in programming languages such as C and JAVAfor accomplishing distributed and asynchronous processing, such asshared memory, memory and message queues, threads, semaphores andmutexes, events, signal handlers, and sockets.

Shared memory and memory and message queues provide functionality toenable multiple C or JAVA programs, for example, to share resources.Threads refer to functionality to enables asynchronous processing toallow a program or application to be split into multiple paths toimprove efficiency. Semaphores and mutexes relate to functionality tocoordinate processing across jobs and threads, respectively. Eventshandle signals from other jobs, while signal handlers refer to thefunctionality for a program to manage exceptions, for example, from theoperating system. Sockets provide programs the capability to shareinformation across machines.

The processing techniques described above are examples of usefulfunctionality widely available to programmers using distributed andasynchronous processing languages, such as C and JAVA, but unavailablein COBOL. Frequently, it is desirable for business processes employingCOBOL applications to accomplish distributed and asynchronousprocessing. Although the COBOL language has limitations, it is difficultfor businesses with a significant investment in COBOL programs tojustify abandoning the COBOL applications and redeveloping theapplications using a more modern and flexible language, such as C orJAVA. Instead, COBOL systems are typically provided with an interface or“hook” to enable the COBOL program to cooperate with, for example, C orJAVA programs. The C or Java program then performs the distributed andasynchronous processing tasks that the COBOL application is otherwiseincapable of handling independently.

SUMMARY OF THE INVENTION

A system for enabling socket communication in COBOL program is provided.The system includes a memory block, a COBOL program communicating withthe memory block, a socket and a COBOL routine callable from the COBOLprogram. The COBOL routine is operable to read information from thesocket and write the information read from the socket to the memoryblock in response to the COBOL program call. A method for socket andpipe communication in COBOL is also provided. The method includesreading, by a routine, information from a socket or pipe and writing, bythe routine, the information to an area. The method provides forreading, by a COBOL program, the information from the area. The COBOLprogram and the routine operating in the same runtime environment.

These and other features and advantages will be more clearly understoodfrom the following detailed description taken in conjunction with theaccompanying drawings and claims.

BRIEF DESCRIPTION OF THE DRAWINGS

For a more complete understanding of the presentation and the advantagesthereof, reference is now made to the following brief description, takenin connection with the accompanying drawings in detailed description,wherein like reference numerals represent like parts.

FIG. 1 is a block diagram illustrating one embodiment of a system forimplementing distributed and asynchronous processing using a COBOLprogram.

FIG. 2 is a block diagram illustrating one embodiment of a technicallayer having a plurality of routines to enable distributed andasynchronous processing in COBOL programs.

FIG. 3 illustrates one embodiment of a socket routine of the technicallayer for enabling socket communications by COBOL programs.

FIG. 4 is a block diagram illustrating one embodiment of a threadroutine of the technical layer for enabling threads in COBOL programs.

FIG. 5 is a block diagram illustrating one embodiment of a semaphoreroutine of the technical layer for enabling semaphores in COBOLprograms.

FIG. 6 is a block diagram, according to one embodiment, of a memoryqueue routine for enabling memory queues in COBOL programs.

FIG. 7 illustrates one embodiment of a shared memory routine of thetechnical layer for enabling shared memory in COBOL programs.

FIG. 8 is a block diagram illustrating a signal handler routine forimplementation in COBOL programs, according to one embodiment.

FIG. 9 illustrates one embodiment of an events routine of the technicallayer for enabling events in COBOL programs.

FIG. 10 is a block diagram of an exemplary system illustratingimplementation of various distributed and asynchronous processes forCOBOL, according to another embodiment.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

It should be understood at the outset that although an exemplaryimplementation of one embodiment is illustrated below, the presentsystem may be implemented using any number of techniques, whethercurrently known or in existence. The present disclosure should in no waybe limited to the exemplary implementations, drawings, and techniquesillustrated below, including the exemplary design and implementationillustrated and described herein, but may be modified within the scopeof the appended claims along with their full scope of equivalents.

FIG. 1 is a block diagram illustrating one embodiment for implementingdistributed and asynchronous processing in COBOL. To the domestic andinternational COBOL programming community, enabling distributed andasynchronous processing for the COBOL programming language is asignificant achievement that enables a new paradigm for COBOLapplications and programmers, whether for mainframe or PC COBOL systems.

The exemplary embodiment enables distributed and asynchronous processingby employing a technical layer 10. A COBOL program 12 is provided, alongwith the technical layer 10, on a computer 14. The COBOL program 12 maybe any type of computer program written in the COBOL programminglanguage, regardless of the version, vendor, level of compliance withthe COBOL ANSI standard, specific compiler or operating system featuresof the COBOL system. The COBOL program 12, in this embodiment, is aCOBOL application or program, or may be a COBOL routine, paragraph,subroutine, subtask or other instructions coded in the COBOL programminglanguage. The computer 14, in this embodiment, is a mainframe computersystem. The present disclosure, however, should not be limited tomainframe computers and may be implemented, in other embodiments, on amid-range computer system, network server or workstation, or desktop orother computers.

The COBOL program 12 is programmed to execute a call to one or morecallable modules or routines (not shown) of the technical layer 10 toperform distributed and asynchronous processing tasks 16 on the computer14. The computer 14 is shown in communication with a second computer 18,which may be similar to the computer 14. In this manner, the COBOLprogram 12 using the technical layer 10 is operable to enable thedistributed and asynchronous processing tasks 16 on the second computer18 as well.

In this embodiment, the technical layer 10, which will be described ingreater detail hereinafter with regard to FIG. 2, is implemented as alibrary having one or more callable modules, routines or subroutinesusable by the COBOL program 12, such as by being linked into the COBOLprogram 12. In other embodiments, the callable modules or routines ofthe technical layer 10 may be integral or incorporated into the COBOLprogram 12. In yet other embodiments, the technical layer 10 may beemployed as a pre-compiler, such that routines or functions enabling thedistributed and asynchronous processing functionality are enabled priorto the COBOL program 12 being compiled. In still other embodiments, thetechnical layer 10 may be enabled as part of a COBOL compiler, such thatthe asynchronous and distributed processing functionality for the COBOLprogram 12 are enabled by the COBOL compiler during compilation.

As discussed above, distributed and asynchronous processing is intendedto describe a variety of functionality that is not native to COBOL orwas not previously available to in the COBOL programming language, butwhich is available in distributed and asynchronous processingenvironments and programming languages such as C and Java. The termsdistributed and/or asynchronous processing, as used herein, are intendedto include, but not be limited to, one or more of the programmingtechniques and functionality for programming, enabling, and managingsockets and pipes, shared memory, threads, memory and message queues,signal handlers, events, semaphores and mutexes.

Technical Layer

FIG. 2 is a block diagram illustrating one embodiment of the technicallayer 10 for enabling distributed and asynchronous processing by COBOLlanguage programs, such as the COBOL program 12. The technical layer 10,when enabled as a COBOL library, may be written in the COBOL programminglanguage as a plurality of paragraphs, routines, or modules callable bythe COBOL program 12 and linked to the COBOL program 12 at theappropriate time. However in other embodiments, the technical layer 10may be written in a variety of other languages, such as, but not limitedto, assembly language. Nothing in this disclosure should be regarded aslimiting or restricting the particular construction or techniques usedto implement the technical layer 10. As previously discussed, thetechnical layer 10 may be implemented, in other embodiments, as acompiler that enables distributed and asynchronous processing routines,functions, or program code of the COBOL program 12 or its sub-programs.

Based on the present disclosure, one skilled in the art would readilyidentify a number of ways to enable distributed and asynchronousprocessing in COBOL language programs. Thus, although the technicallayer 10 in the present embodiment is provided as a COBOL languageprogram library, each of the various routines and instructions forenabling each of the distributed and asynchronous processes may beimplemented as individual programs or systems or separated intodifferent combinations, all of which are within the spirit and scope ofthe present disclosure.

In addition, the technical layer 10 may be embodied as one or morelayers or sub-layers, systems or subsystems, which may be beneficial insome aspects for ease of maintenance and for adaptation to other systemsfor reasons of compatibility, performance or efficiency. For example thetechnical layer 10 may include an operating system calls layer (notshown). Such an operating system layer may be provided for handlingspecific operating system calls from the technical layer 10 to aparticular mainframe or computer operating system. Thus, an operatingsystem layer allows the technical layer 10 to be independent of anyparticular operating system. This implementation simplifies migration todifferent mainframe or other computer operating systems without the needto completely replace or rewrite the technical layer 10 for operation onanother operating system. Whether or not an operating system layer isemployed, the technical layer 10 insulates the COBOL program 12 from theoperating system, making the COBOL program 12 operating systemindependent and readily portable to other operating systems andplatforms.

The technical layer 10 has a plurality of routines 20 including, but notlimited to, routines for enabling distributed and asynchronousprocessing by COBOL language programs, such as POSIX functionalityavailable in other languages. The plurality of routines 20 of thetechnical layer 10 are designated alphanumerically for purposes ofclarity for this disclosure. The plurality of routines 20 include asignal handler routine 20 a, an events routine 20 b, a shared memoryroutine 20 c, a threads routine 20 d, a sockets routine 20 e, a pipesroutine 20 f, a memory queue routine 20 g, a message queue routine 20 h,a semaphore routine 20 i, and a mutex routine 20 j.

Briefly, the signal handler routine 20 a provides functionality toenable the COBOL program 12 to work with operating system generatedevents. The events routine 20 b enables the COBOL program 12 to managesignals from other jobs. The shared memory routine 20 c provides theCOBOL program 12 with the functionality to enable memory sharing on thecomputer 14, or other computers, with other COBOL programs. The threadsroutine 20 d enables COBOL applications to be split into multiple paths.The sockets routine 20 e enables the COBOL program 12 to communicateinformation between, for example, the computer 14 and the secondcomputer 18, via a socket connection. The pipes routine 20 f providesfunctionality to enable the COBOL program 12 to communicate via pipeconnections on the computer system 14.

The memory queue routine 20 g and message queue routine 20 h providefunctionality to enable the COBOL program 12 to use memory queues on thecomputer 14, as well as message queues employed by and between computersystems. The semaphore routine 20 i provides functionality to coordinateprocessing across jobs, while the mutex routine 20 j enables COBOLlanguage programs to coordinate processing across threads. The term jobincludes instructions sent in a batch manner to a computer as a unit ofwork to be accomplished by the computer. The term threads includes asequence of computer instructions that make up a program such thatmultiple threads can be executed independently to improve programefficiency.

Each of the routines 20 of the technical layer 10 may be employedindividually or in various combinations or in the combinationillustrated in FIG. 2. As such, each of the individual routines 20 orcombination of routines 20 may be enabled in a number of ways including,but not limited to: provided as a library linkable to the COBOL program12; provided as routines that are nested, embedded or otherwise includedin the COBOL program 12; provided in a pre-compiler configuration wherethe functionality of the routine 20 is in enabled in the COBOL program12 during a process prior to compilation; or provided as a COBOLlanguage compiler where the functionality provided by the routine 20 isenabled during compilation of the COBOL program 12. In any case, thepresent disclosure enables asynchronous and distributed processing byone or more COBOL programs or routines either independently or employingassociated systems, such as but not limited to the above described list,within the COBOL programming language or the same runtime environment.Other methods of enabling one or more of the distributed andasynchronous processing capabilities disclosed herein will readilysuggest themselves to one skilled in the art.

In the present embodiment, the routines 20 are provided as part of thetechnical layer 10 in a library that is easy to maintain and adapt asnecessary. Such implementation allows for the library to be readilypackaged for use by other COBOL language developers and may bedistributed including the source code or may be distributed only asobject code. In either case, the COBOL language programmers can easilyemploy the technical layer 10 as a library without changes to theunderlying COBOL language system and quickly begin using the distributedand asynchronous processing functionality provided in the presentdisclosure.

Sockets and Pipes

FIG. 3 is a diagram illustrating the functionality of the socket routine20 e for enabling the COBOL program 12 for communication with a socket30. The socket 30 may represent a communication channel establishedbetween one or more computer systems, such as the first computer 14 andthe second computer 18 (illustrated in FIG. 1). Functionally, the COBOLprogram 12 requests communication, via a socket, from the socket routine20 e. The socket routine 20 e establishes the socket connection with thesocket 30, such as by a call to an operating system 34. The operatingsystem 34 may be any operating system operable on the computer 14. Inthe present embodiment, the COBOL program 12 is operable on an IBMmainframe computer system using a zOS operating system.

The COBOL program 12 may, for example, initiate a call to a function ofthe operating system 34 to accept a connection request from a client.Examples of such calls are provided in the operating system's callableservices reference manual. It may be necessary to refer to the specificdocumentation for the operating system where the technical layer 10 andCOBOL program 12 will be employed to determine the correct syntax andfunctionality. The operating system calls, including the syntax andtechniques for the COBOL program 12 to communicate with the operatingsystem 34 via the technical layer 10, may vary greatly depending uponthe desired operating system. As previously described, the technicallayer 10 may be separated into multiple layers including an operatingsystem layer that maintains each of the operating system calls forcompatibility with specific operating systems. As such, the technicallayer 10 would require little or no modification to enable compatibilitywith other operating systems. By abstracting the specific calls to asingle layer, the technical layer 10 and COBOL program 12 remainsubstantially the same regardless of the operating system, thuseliminating or reducing the need to maintain different versions of thetechnical layer 10 or COBOL program 12 for different operating systems.Regardless, any change in the technical layer 10 to accommodatedifferent operating systems would be transparent to the COBOL programsusing the technical layer 10.

In the present embodiment, and referring to the above describedoperating system documentation, the “accept (BPX1ACP)” is theappropriate call to accept a connection request from a client. Thisoperating system function extracts the first connection on the queue ofpending connections, creates a new socket with the same properties asthe specified socket and allocates a new descriptor for that socket, asprovided in the documentation. If there are no connections pending, theservice either blocks until a connection request is received, or failswith an EWOULDBLOCK, depending upon whether the specified socket ismarked as blocking or non-blocking. Thus, the socket routine 20 e isoperable, via the operating system 34, to establish and communicate viathe socket 30. It will be appreciated that a number of operating systemcalls and communications are employed by the routines 20 of thetechnical layer 10. For purposes of clarity and brevity of disclosure,only the above operating system call and function is described. Thespecifics for additional operating system calls and functions may beobtained by referring to the above or desired operating systemdocumentation and relevant COBOL programming language support materials.

The operating system call is made from the socket routine 20 e, which,in the present embodiment, is a program written in COBOL having aroutine or paragraph wherein a call is made in the COBOL code to theoperating system 34 as described above. The called operating systemfunction returns information used by the socket routine 20 e for thesepurposes. For example, the above call is described in the documentationas follows: CALL BPX1ACP,(Socket_descriptor,Sockaddr_length,Sockaddr,Return_value,Return_code,Reason_code)The actual implementation of the operating system calls will varydepending upon the different functionality enabled in various portionsof the technical layer 10. Regardless of the specific operating systemcall, technique for making the call, and whether or not the call is madefrom a COBOL language program, it is readily apparent that enabling atechnical layer 10 for use by a COBOL program allows the COBOL programto accomplish communication with the socket 30. In light of the abovedescription, one skilled in the art can see that using operating systemcalls from COBOL programs or routines could also be used to make othercalls to the operating system 34, as well as other operating systems,and for brevity only the above call will be described in detail.

When the technical layer 10 is programmed in COBOL, as is the case inthe present embodiment, the operating system calls require bit levelmapping of the calls, parameters and returned information to complete aCOBOL programming language call to the operating system 34. Someoperating system calls may be accomplished otherwise. However, thepresent embodiment employs the bit level calls to communicate with theoperating system to enable the COBOL program to look like an assemblercall, as necessitated by the operating system. As such, the call to theoperating system 34 has the correct bits, offsets and memory mapping tosufficiently interface with the operating system 34. As previouslydiscussed, these specific bit level calls, including offsets, willdepend upon the particular operating system 34 that is being employed.

Source code for the socket interface call from a COBOL language program,according to the present embodiment, is provided below. A number ofinteresting aspects of the code are apparent, including that the codeprovides a nested program called GETADDR that provides the address of aninternal area into a pointer variable. This address moved into anexternal area prior to making the socket call. This is one method forcircumventing a limitation of the COBOL compiler that restricts settingpointer addresses to areas that are in linkage. Using the external areato communicate the address of the requesting program's socketcommunication area allows the program to be used in either 24 or 32 bitmode, which may also be referred to as above or below the line.01 WS-SOCKET-AREA.   02 WS-SOCKET-ACTION PIC X(1).   02 WS-SOCKET-FD.    05 WS-SOCKET-FD-NUM PIC 9(9) COMP.   02 WS-SOCKET-IPADDR.     05WS-SOCKET-IPADDR-N PIC 9(9) COMP.   02 WS-SOCKET-OCTETS REDEFINESWS-SOCKET-IPADDR.     05 WS-SOCKET-IPADDR-B OCCURS 4 TIMES       INDEXEDBY WS-SOK-IP-IDX PIC X(1).   02 WS-SOCKET-PORT PIC 9(9) COMP.   02WS-SOCKET-INPUT-LEN PIC 9(4) COMP.   02 WS-SOCKET-INPUT-NAME-AREA.    05 WS-SOCKET-INPUT-NAME PIC X(10).     05 FILLER PIC X(1) VALUE ‘I’.    05 WS-SOCKET-INPUT-PID PIC 9(09).   02 WS-SOCKET-OUTPUT-LEN PIC 9(4)COMP.   02 WS-SOCKET-OUTPUT-NAME-AREA.     05 WS-SOCKET-OUTPUT-NAME PICX(10).     05 FILLER PIC X(1) VALUE ‘O’.     05 WS-SOCKET-OUTPUT-PID PIC9(09).   02 WS-SOCKET-IN PIC S9(9) COMP.   02 WS-SOCKET-OUT PIC S9(9)COMP.   02 WS-CLIENT-FD PIC S9(9) COMP.   02 WS-SOCKET-CHARS-IO PICS9(9) COMP.   02 WS-SOCKET-REC-LEN PIC S9(9) COMP.   02 WS-SOCKET-REC.    05 WS-SOCK-CHAR OCCURS 2000000 TIMES             PIC X(1).01 WS-POINTERS.   02 WS-SOCKET-INTF-PTR POINTER.   02 CL-CLIENT-INTF-PTRPOINTER.   02 SZ-CLIENT-INTF-PTR POINTER.   02 RM-CLIENT-INTF-PTRPOINTER. 01 EX-SOCKET-INTF-AREA EXTERNAL.   02 EX-SOCKET-INTF-PTRPOINTER. CALL ‘GETADDR’ USING WS-SOCKET-AREA,           WS-SOCKET-INTF-PTR. SETEX-SOCKET-INTF-PTR    TO  WS-SOCKET-INTF-PTR. PERFORMV1000-CALL-SOCKET-INTERFACE. PERFORM C1000-CHECK-RETURN-CODE.************************************************ * CALL SOCKET INTERFACEROUTINE ************************************************V1000-CALL-SOCKET-INTERFACE.   CALL ‘HHABSSOK’. LINKAGE SECTION.01 WS-AREA PIC X(1). 01 WS-ADDR POINTER. PROCEDURE DIVISION USINGWS-AREA WS-ADDR. MAIN.   SET WS-ADDR TO ADDRESS OF WS-AREA.   GOBACK.END PROGRAM GETADDR.

In other embodiments, the technical layer 10 may be implemented whereinthe specific syntax from the COBOL language program is separated withthe EXEC/END-EXEC and the syntax is stripped out of the source COBOLlanguage program in a pre-compile step and replaced with calls to thetechnical layer 10. In addition, the operating calls and/or routines 20may be provided in a COBOL language compiler as previously discussed.

Once the socket routine 20 e establishes the connection with the socket30, via the operating system 34, the socket routine 20 e is thenoperable to read and write information from the socket 30. The socketroutine 20 e receives information from the socket 30 and writes theinformation to a memory 36, such as a block of memory of the computer14. In the present embodiment where the computer 14 is a mainframe, thesocket routine 20 e receives the information from the socket 30 and isoperable to convert the information based on the formats of the sendingand receiving platforms. For example, the socket routine 20 e mayreceive the information in ASCII format and convert the information toEBCDIC format for use on a mainframe, or vice-versa.

The COBOL program 12 then reads the information from the memory 36 thusenabling the COBOL program 12 to communicate via the socket 30. In someembodiments, the COBOL program 12 allocates the memory 36, and thusobtains the address of the memory 36. In the present embodiment, thesocket routine 20 e establishes the memory 36 and the COBOL program 12obtains the address of the memory 36 from the socket routine 20 e. Ineither case, the COBOL program 12 uses the address of the memory 36 andlays a map over the memory 36 to read the information from the memory36. One method of accomplishing this technique is for the COBOL program12 to employ a copybook for reading the memory 36 information into theCOBOL program 12.

In the present embodiment, the socket routine 20 e creates the socket 30and may be thought of as providing a file descriptor that describes astream. The socket routine 20 e obtains or is provided the address orthe target where the data or information coming off the socket 30 shouldbe provided. The COBOL program 12 maps the address of the memorylocation 36 to the working storage section of the COBOL program 12. TheCOBOL program 12 can then analyze the information obtained from thesocket 30 in any desirable manner. Thus, the socket routine 20 e readsthe data streaming off the socket 30 and writes the data to a file ormemory for access by the COBOL program 12. The socket routine 20 e andthe COBOL program 12, in this embodiment, cooperate to synchronize thisactivity by the COBOL program 12 requesting that the socket routine 20 eread additional data off the socket 30 each time the COBOL program 12finishes reading or manipulating the data previously written to the fileor memory from the socket routine 20 e. The present embodimentillustrates the additional functionality and flexibility provided bythis socket routine 20 e, and which is also provided by the pipesroutine 20 f that will be described hereinafter, to enable COBOLprogrammers the ability to accomplish, for example, messaging in adistributed environment.

To write to the socket 30, the COBOL program 12 may, in one embodiment,write the information or data to the memory 36 or provide theinformation directly to the socket routine 20 e. After receiving theinformation, the socket routine 20 e writes, via the operating system34, the information to the socket 30. To accomplish the various socket30 related functions, the socket routine 20 e is provided with a numberof functions callable from the COBOL program 12 or enabled by thetechnical layer 10, including a create function to create a new socket,an attach function to attach to existing sockets, and an open functionto open the socket 30.

Other functions of in the socket routine 20 e include a write functionto write data into the socket 30 and a block function to prevent writingto the socket 30 when the socket 30 is full. The socket routine 20 eincludes a read function to read data from the socket 30, substantiallyas described above. A remove function enables the socket routine 20 e toremove sockets 30 from the system, and a delete function is operable todelete sockets where the socket 30 has not yet been opened. In thepresent embodiment, the socket routine 20 e also includes a listeningport function that allows the socket routine 20 e to monitor the socket30 for communications and additional functionality for managing theconnection of the socket 30. A number of the socket functions describedabove may be enabled via operating system calls, for example, from thesocket routine 20 e to enable socket communications.

The pipes routine 20 f functions and operates in a manner substantiallysimilar to that of the socket routine 20 e. Sockets are essentiallycommunications between separate machines whereas pipes are essentiallycommunications on the same or local machine. For reasons of brevity, thepipes routine 20 f will not be described in detail due to thesimilarities in construction and function of the pipes routine 20 f andthe socket routine 20 e. The modifications necessary to enable the pipesroutine 20 f are based on the local nature of pipes and will be apparentto one skilled in the art. The pipes routine 20 f also includesfunctionality, for example, to prevent reading from an empty pipe,prevent writing to a full pipe, and waiting before writing to a fullpipe as well as balancing where one or more of the pipes are full.

The pipes routine 20 f provides COBOL programmers the ability toaccomplish asynchronous processing by reading and writing to multiplepipes and enabling multiple child processes to simultaneously readinformation from pipes. The pipes and sockets functionality washeretofore unavailable to COBOL programmers. Previously COBOL programswere only able to read from a file, such as a database or an indexsequential file or VSAM file, and were not provided with thefunctionality to read, manage and write information from socket and pipeconnections.

Threads

FIG. 4 is a block diagram illustrating the threads routine 20 d of thetechnical layer 10. Threads provide for asynchronous processing bymultiple processes simultaneously. The threads routine 20 d achieves thefunctionality of native threads, as used in C and Java, and enables themfor the COBOL language by employing and managing subtasks, as describedbelow, which were not previously used by COBOL programs in this manner.The threads routine 20 d enables COBOL applications to be split intomultiple paths. FIG. 4 illustrates a first COBOL program 50 and a secondCOBOL program 52, which are both similar to the COBOL program 12illustrated in FIG. 1. The threads routine 20 d allows the first andsecond COBOL programs 50 and 52 to use a shared memory 54 to enablethreads for COBOL. The operation and function of shared memory will bediscussed in greater detail hereinafter with regard to FIG. 7.

In the present embodiment, the first and second COBOL programs 50 and 52write an output to the shared memory 54. The threads routine 20 d isoperable to read the information written to the shared memory 54 by thefirst and second COBOL programs 50 and 52 and write the information to ashared resource 56. Using COBOL language program calls to the operatingsystem 34, for example, the threads routine 20 d enables the first andsecond COBOL programs 50 and 52 to operate as asynchronous subtaskswherein both the first and second COBOL programs 50 and 52 use the sameaddress space, but employ distinct process ID numbers. Distinct processID numbers would be used in the present embodiment where the system isoperating on a mainframe computer system. In this environment, only oneof the first and second COBOL programs 50 and 52 would be able to writeto the shared resource 56 without causing a conflict. The present systemresolves this potential for conflicts by employing the mutex routine 20j, which will be discussed in greater detail hereafter. The mutexroutine 20 j protects the shared memory 54 so that both the first andsecond COBOL programs 50 and 52 can write information to the sharedmemory 54, which is eventually written to the shared resource 56 by thethreads routine 20 d. This function allows the first and second COBOLprograms 50 and 52 to both output, although indirectly, to the sharedresource 56. The mutex routine 20 j also functions to serialize thetransfer of the information written to the shared memory 54 out to theshared resource 56, eliminating the potential for conflicts whenoutputting to the shared resource 56.

In addition, the threads routine 20 d is operable to detect when asubtask goes down, or has some other type of failure. The thread routine20 d is further operable to restart the subtask. In a mainframeenvironment when a subtask abruptly ends, no messages or events providenotice or warning to indicate that the subtask has ended. The threadsroutine 20 d monitors and detects when a subtask, such as the first andsecond COBOL programs 50 and 52, ends and is further operable to restartthe subtask, by using the process ID assigned to the subtask. Inaddition the threads routine 20 d is operable to maintain a log to trackinformation, such as but not limited to, the information written fromthe first and second COBOL programs 50 and 52 to the shared memory 54.The log may also maintain the process ID's of the first and second COBOLprograms 50 and 52 and the information and data written by the threadsroutine 20 d to the shared resource 56. This information is useful foroperation of the threads routine 20 d, as well as for developers andadministrators to track program events.

The threads routine 20 d, using some of the functionality of the mutexroutine 20 j, enables COBOL language programmers to operate COBOLprograms as threads by employing them as subtasks. Further, the threadsroutine 20 d eliminates the negative effects of autonomous subtaskswriting to the shared resource 56, such as SYSOUT, which would otherwisecreate potential for system errors and instability. The threads routine20 d allows for asynchronous processing simultaneously as opposed to thetraditional COBOL tops-down programming approach.

Employing the threads routine 20 d, COBOL programmers can now break-uplarge database file reading operations into multiple threads to readthrough large files and databases much more rapidly and efficiently.Enabling this functionality required, among other things, identifyingthe differences between mainframe COBOL programming and threads asnatively used in languages such as C or Java. For example, threadsnatively share, for example, address space, process, memory and filespace as well as returning a message in the event a thread abruptlyterminates. To enable threads for COBOL, the technical layer 10 usessubtasks. COBOL was not previously operable to support subtasks in thismanner. Subtasks use the same address space, have distinct process IDs,and share memory, but not file space. As discussed above, subtasks donot provide notification when they abnormally terminate. The threadsroutine 20 d must manage these and other aspects of subtasks. In thepresent embodiment, the threads routine 20 d of the technical layer 10uses, among other techniques, subtasks to accomplish the threadfunctionality that is natively supported in computer languages such as Cor Java.

Semaphores and Mutexes

FIG. 5 illustrates a portion of the technical layer 10 operable forcoordinating processing in COBOL programs using semaphores and mutexes.Semaphores allow processing across jobs, such as between or acrossseparate programs, while mutexes allow processing across threads, orinside of programs. These functions are further operable to synchronizethese processes. The semaphore routine 20 i is illustrated communicatingwith the first and second COBOL programs 50 and 52 which may beindependent programs or routines. In the present embodiment, the firstand second COBOL programs 50 and 52 are subroutines or subtasks of aparent COBOL program 70.

The technique for coordinating processing in COBOL programs includes thefirst and second COBOL programs 50 and 52 having a first and secondroutines 72 a and 72 b, respectively, for processing. The semaphoreroutine 20 i is callable by the first and second COBOL programs 50 and52 and maintains a shareable state 74 to coordinate the processing ofthe first and second routines 72 a and 72 b. For example, the firstCOBOL program 50 calls the semaphore routine 20 i with an argument tolock the semaphore or state 74. Provided that the state 74 does notindicate that the semaphore is already locked, the semaphore routine 20i locks the semaphore. The state 74 may be a flag or other method forindicating that a shared process is in use.

Certain operations may only be accomplished in a serial manner withoutcausing system errors or instability. For example, writing to the sharedresource 56 by multiple programs simultaneously may cause errors. Thesemaphore routine 20 i addresses this problem, according to the presentembodiment, by associating the particular operation or job with a stateor flag that is shareable between programs. Thus, when the second COBOLprogram 52 initiates the same process and attempts to lock the semaphorerelated to a particular operation, the semaphore routine 20 i willindicate that the state 74 is locked and the processing of the secondroutine 72 b goes into an event wait state.

The second COBOL program 52 and/or second routine 72 b polls thesemaphore routine 20 i to determine the status of the shareable state74. Once the semaphore is unlocked, as indicated by the shareable state74, then the second routine 72 b begins processing. In this manner, thesemaphore routine 20 i prevents multiple routines from processing to theshared resource 56 to prevent conflicts, errors, or other instabilitiescaused when multiple processes simultaneously write to an output orshared resource, such as SYSOUT.

Once the semaphore is locked, the semaphore then processes the job tothe shared resource 56, such as shared memory, a file, a block of memorythat is not shareable, a database, or other shared resource 56. In thepresent embodiment, the semaphore routine 20 i, when called by the firstor second COBOL programs 50 and 52, creates the shared semaphore andassociates a shareable state 74 with the created semaphore. Thesemaphore routine 20 i is operable to create and manage a plurality ofsemaphores related to various operations and maintain multiple shareablestates 74 each associated with one of the created semaphores. Inaddition, the semaphore routine 20 i is operable to create and sharesemaphores between a plurality of COBOL programs such as a third andfourth COBOL programs (not shown), while the first and second COBOLprograms 50 and 52 use the same or another semaphore.

The semaphore routine 20 i is provided with a plurality of functionalityfor maintaining semaphores including: creating a semaphore, obtaining anidentifier related to the semaphore, identifying the semaphore, queryingto determine whether the shareable state 74 indicates that the semaphoreis locked, changing the status of the shareable state 74 to indicatethat the semaphore is locked, as well as changing the status of theshareable state 74 to indicate the semaphore is unlocked and available.Additional functionality includes obtaining a process identification orID number to determine the process associated with the semaphore andremoving the semaphore from the computer system.

In other embodiments, the first and second COBOL programs 50 and 52 areoperable to independently determine the status of the shareable state74, as well as other processes associated with semaphore routine 20 i.In still other embodiments, the first and second COBOL programs 50 and52 only process a request to the semaphore routine 20 i, which in turnreturns the information requested by the first and second COBOL programs50 and 52.

The construction and function of the mutex routine 20 j is substantiallysimilar to that of the semaphore routine 20 i and the differences arebased primarily on the characteristics of mutexes. Specifically, thesemaphore routine 20 i manages jobs which are processed in separateaddress space and which work across various jobs. The mutex routine 20j, on the other hand, manages the coordination of processing withinsubtasks using the same address space. In any event, the semaphore andmutex routines 20 i and 20 j provide a mutually exclusive capability tolock the semaphore or mutex by a first process which causes the secondprocess to suspend or wait until the semaphore or mutex becomesavailable. This functionality prevents multiple jobs from simultaneouslyupdating the shared resource 56.

The semaphores and mutexes routines 20 i and 20 j provide the COBOLlanguage and COBOL developers additional programming capabilities bymanaging asynchronous processes to prevent multiple process, tasks, orjobs from updating the same shared resource 56 at the same time. In thepresent embodiment, the semaphore routine 20 i and mutex routine 20 jenable this functionality by making the appropriate calls to theoperating system. In the present embodiment, the semaphores and mutexesroutines 20 i and 20 j are computer programs written in the COBOLprogramming language and the operating system calls are accomplishedsubstantially as described above with respect to sockets.

Memory Queues and Message Queues

FIG. 6 illustrates one embodiment of the memory queue routine 20 g ofthe technical layer 10 for enabling queues in COBOL programs. The memoryqueue routine 20 g maintains an index 90 having one or more keys 92 tomanage the memory 36 of the computer 14. The memory queue routine 20 gcommunicates with the operating system 34 to retrieve an address 94 inmemory 36 based on the key 92. The operating system 34 maintains the key92 related to the address 94 of the memory 36 wherein the relevantinformation and data is stored. The COBOL program 12 includes a linkagesection 96, which is a standard portion of a COBOL program that isordinarily used to receive data that is passed in from other programs.The COBOL program 12 communicates with the memory queue routine 20 g toreceive the address 94 of the memory 36.

In the present embodiment, the COBOL program 12 includes an identifierassociated with the key 92, such as an alphanumeric identifier or nameused by the COBOL program 12 to call the memory queue routine 20 g. Thememory queue routine 20 g looks up the identifier or name in the index90 and obtains the associated key 92. In the manner described above, thememory queue routine 20 g obtains the address 94 in memory 36 related tothe key 92 and returns the address 94 to the COBOL program 12.

In one embodiment, the COBOL program 12 makes a linkage call by name tothe memory queue routine 20 g requesting the address 94 in memory 36 fora particular memory queue to be used. The memory queue routine 20 glooks up the name in the index to return the address 94 to the linkagesection 96 of the COBOL program 12. By mapping the linkage section 96 ofthe COBOL program 12 to the address 94, the COBOL program 12 resolvesthe data at the address 94 of the memory 36 to the linkage section 96 ofthe COBOL program 12. Thus, the COBOL program 12 considers theinformation stored in memory at the address 94 as local and accessibleto the COBOL program 12. This technique is effective to enable memoryqueues for the COBOL programming language.

The memory queue routine 20 g is operable to serialize the informationin the memory queue in various orders, including in last-in-first-outorder. In some instances, it may be useful for the memory queue routine20 g to coordinate reading and writing information in afirst-in-first-out order. The memory space at the address 94 is operablefor a memory queue and the memory queue routine 20 g coordinates, or insome instances may directly or exclusively control, the reading andwriting of information to prevent conflicts in the memory queue.

In the present embodiment, the memory queue routine 20 g is programmedin the COBOL programming language and the memory queue is enabled via acall to the operating system by the memory queue routine 20 g. As such,the operating system 34 creates and enables the memory queue for use bythe COBOL program, via the memory queue routine 20 g.

The construction and function of the message queue routine 20 h issubstantially similarly to that of the memory queue routine 20 gillustrated in FIG. 6. When the message queue routine 20 h is employedin lieu of the memory queue routine 20 g, the memory space located atthe address 94 is operable for a message queue. In this embodiment, themessage queue routine 20 h receives the request from the COBOL program12 to read and write information to the message queue. In oneembodiment, the message queue routine 20 h coordinates the reading andwriting of information to the message queue in a last-in-first-outorder, while in still other embodiments the order is first-in-first-out.

The message queue functionality is enabled by the message queue routine20 h via a call to the operating system 32, as discussed above. As isthe case with the memory queue routine 20 g, the message queue routine20 h includes a plurality of functions to manage message queuesincluding a create function to create new queues such as by initiatingan appropriate operating system call. Other functions include an attachfunction for connecting to existing queues and a query function todetermine whether a queue exists and obtain the size of the queue interms of the number of rows as well as additional information related tothe queue. Some other functions of the message queue routine 20 hinclude a push function to add a row to the queue and a block functionto block when the queue is full. A pop function removes the top row fromthe queue and also prevents this operation when no more rows exist onthe queue. Additional functions provide for detaching from an existingqueue and removing the queue from the system.

The functions of the message queue routine 20 h and memory queue routine20 g may be called directly from the COBOL program 12, or routines 20 inthe technical layer 10 provided as a library linkable to the COBOLprogram 12, as previously discussed above. In another embodiment, thefunctionality of the memory queue routine 20 g may be enabled as amessage queue by providing a socket layer around the memory queue. Also,the message queue routine 20 h is operable to maintain the address 94 ofmemory 36 as a fixed size and block when the memory 36 is full, such asby employing semaphores. Similarly, pushing data onto the queue mayrequire serialization so that processes, such as multiple subtasks donot simultaneously insert data into the same point in the queue, oraddress space 94 of memory 36. This serialization may be enabled as partof the message queue routine 20 h, for example.

In the present embodiment, it may be useful on the input side forrecords to be maintained by only one job or process at a time as opposedto multiple jobs. While on the output side, data may be preferablycoming out of only one process as opposed to multiple processes for thepurposes of serializing the process. The message queue routine 20 h andmemory queue routine 20 g provide new capability to the COBOLprogramming language and COBOL developers, by providing queuefunctionality for multiple COBOL programs and processes.

Shared Memory

FIG. 7 illustrates one embodiment of the shared memory routine 26 forsharing memory between COBOL programs. The shared memory routine 20 c isprovided with an index 110 for maintaining a plurality of keys 112related to an address 114 in memory 26 that is used as shared memory bythe first and second COBOL programs 50 and 52. The first COBOL program50 requests shared memory from the shared memory routine 20 c. Theshared memory routine 20 c includes a plurality of functions operablefor managing shared memory, including a create function for creating ashared memory block. In the present embodiment, the shared memoryroutine 20 c is a COBOL program that issues a call to the operatingsystem 34 to allocate the appropriate amount of memory.

By providing the shared memory routine 20 c as a COBOL library, thefirst COBOL program 50 may be compiled to enable this functionality. Theamount of memory needed by the first COBOL program 50 is designated bythe first COBOL program 50 at compile time. Based on the call from theshared memory routine 20 c, the operating system 34 allocates the memoryrequired for the working storage section of the first COBOL program 50.The operating system obtains the address 114 for the designated memory36 to be shared between the COBOL programs. The first COBOL program 50identifies the shared memory 36 using an identifier, such as analphanumeric identifier or name, for example. Once the shared memory hasbeen identified, the first COBOL program 50 can begin using the sharedmemory 36 via a request to the shared memory routine 20 c.

The shared memory routine 20 c maintains the identifier in the index 110along with the associated key 112. The shared memory routine 20 c usesthe key 112 to issue a request to the operating system for the address114 in memory 36 that will be shared. The operating system 34 passes theaddress 114 back to the shared memory routine 20 c, which in turn passesthe address 114 back to the linkage section 96 a of the first COBOLprogram 50.

As previously discussed, the linkage section 96 a of the first COBOLprogram 50 is typically used for passing information between subprogramsor calling programs, but is employed in a novel manner in the presentembodiment to map to the address 114 of the memory 26 that is used forshared memory. Mapping the address 114 to the linkage section 96 a ofthe first COBOL program 50 is useful since shared memory only needs tobe loaded one time and does not require constant refreshing. Forexample, data space is known as a section of mainframe memory that staysresident when programs exit, but requires a task running to keep thememory refreshed. Core loads are another example of memory employed inmainframe computer systems, but when the program using the memory exitsor closes, the memory is released and the data is no longer available.Employing the shared memory routine 20 c according to the presentaspect, the memory is maintained by the shared memory routine 20 c evenafter the first COBOL program 50 terminates.

The second COBOL program 52, using the same identifier or name, requeststhe address 114 in memory 36 where the shared memory is located. Theshared memory routine 20 c returns the address 114, in a similar manner,based on the use of the same identifier or name. The address 114 of theshared memory is mapped back to the linkage section 96 b of the secondCOBOL program 52 thereby creating a shared block of memory useable byboth the first and second COBOL programs 50 and 52.

The shared memory routine 20 c is operable to manage multiple sharedmemory blocks based on a unique name or identifier associated with theeach address 114 of the array in memory 36. The shared memory blocks canthen be accessed by numerous COBOL programs, via the shared memoryroutine 20 c, by referencing the unique identifier. A number oftechniques for managing the unique identifiers, or associating,organizing or referencing memory blocks by and between COBOL programsmay be used since the present system is not limited to any particularimplementation. In addition to those functions previously described, theshared memory routine 20 c includes an attach function to attach to anexisting block of memory, a detach function to detach from an existingblock of memory, a remove function to remove a shared memory block fromthe system, and a query function to determine whether a shared block ofmemory exists and obtain the size and other information about the sharedmemory block.

In other embodiments, the shared memory routine 20 c may be providedwith one or more indexes 110 for maintaining identifiers and keys 112,each of which may be queried by the COBOL programs. In one embodiment,the shared memory routine 20 c monitors the shared memory when thememory is protected to prevent the shared memory from being overwritten.In yet other embodiments, the memory may be unprotected and the sharedmemory routine 20 c may allow the COBOL programs to read and write frommemory in an unrestricted manner. A number of techniques may be employedfor managing the protection and privileges of shared memory and arewithin the spirit and scope of the present disclosure.

In the present embodiment, the shared memory routine 20 c manages theprotected and unprotected aspects of the shared memory by virtue of thespecific operating system call. For example, the type of call dictatesthe way the operating system 34 will manage the protection of the blockof memory 36 used for shared memory. In any event, the shared memoryroutine 20 c enables the COBOL language to be programmed for memorysharing between COBOL programs enabling a new level of functionality inCOBOL language programs.

Signal Handlers

FIG. 8 is a block diagram illustrating the signal handler routine 20 ato enable COBOL programs to use signal handlers. The signal handlerroutine 20 a operably communicates with the COBOL program 12 to receivea signal handler 130 designated by the COBOL program 12 to execute basedon an event. The signal handler routine 20 a registers the signalhandler 130 with the operating system 34 so that the operating system 34executes the signal handler 130 on the event.

When, for example, the operating system detects that a program ABENDS(abnormal end), or otherwise detects an error, the operating systemissues an event. A number of handlers are operable to launch specificprocesses when these events occur. For example, specific programs suchas the signal handler 130 can be registered with the operating systemand executed on the registered event. The signal handler routine 20 a isoperable to register programs, such as the signal handler 130, with theoperating system 34 for execution on such events. The signal handlerroutine 20 a is not limited to input-output error or events and may alsoregister programs to be executed for memory exceptions, programprotection violations, and other events.

The signal handler routine 20 a is further operable to initiate aseparate thread for execution of the signal handler 130 when the eventoccurs. The signal handler routine 20 a identifies the program name orother identifier of the signal handler 130. The signal handler routine20 a registers this name with the operating system 34 and associates thename with a desired event. The signal handler routine 20 a enables thesignal handler functionality for COBOL programs by, for example, anoperating system call. In the present embodiment, the signal handlerroutine 20 a is a COBOL language program employed by the COBOL program12 as a library that makes the operating system call, similar to thatdescribed above. In the present embodiment, the signal handler 130 maybe any program, such as a notification program registered with theoperating system that provides relevant notice on the registered event.The signal handler 130 may be programmed to correct, recover, terminate,or take other action based on the event.

The signal handler routine 20 a is operable to maintain a log ofprocesses, such as in a shared block of memory, to track the processesoperating on the computer 14. When a particular event occurs the log canbe queried to determine the last process or program operating. In thismanner, the signal handler routine 20 a is operable to not only handleevents from the operating system which executes signal handlers on theevents, but also to track the processes to help identify the relevantprocesses or programs that triggered the event and the signal handler130. This functionality is useful for debugging programs, for example,since the program or process that generated the error is typicallyidentifiable from the log. Further, programs that generate erroneousdata or output are also readily identifiable since the program and theoutput may be logged and reviewed.

In some embodiments, the signal handler routine 20 a is operable toregister multiple signal handlers 130 related to one or more operatingsystem events. The signal handler routine 20 a may be further operableto enable the COBOL program 12 to directly register the signal handlers130 with the operating system 34.

Events

FIG. 9 illustrates the function and operation of the events routine 20 bto enable events in COBOL programs. The events routine 20 b is operableto allow COBOL programs to perform asynchronous processing and furtherto coordinate request handling across multiple child processes. TheCOBOL program 12 maintains an index 150 including a processidentification number or PID 152 and an event 154 associated with eachof a plurality of child processes 156. The child processes aredesignated alphanumerically as child processes 156 a, 1156 b, and 156 c.The child processes are subtasks, subprograms, or subroutines of theparent program, such as COBOL program 12. The child processes operate,in this embodiment, as threads which may be enabled by the threadsroutine 20 d discussed above.

Signals

When the COBOL program 12 initiates the child process 156, such as childprocess 156 a, the COBOL program 12 puts the child process 156 a into anevent wait. In this embodiment, the events routine 20 b may place thechild process 156 a into the event wait. The child process 156 aregisters with the COBOL program 12 such that the process ID 152 andevent that the child process 156 a is waiting on are recorded in theindex 150 of the COBOL program 12. The COBOL program 12 may obtain aprocess ID 152 and event 154 associated with the child process 156 a oninitializing or on starting the child process 156 a or may obtain thisinformation subsequently from the events routine 20 b. In some cases,the child process 156 a would not be required to register with the COBOLprogram 12.

In the present embodiment, the child process 156 a registers with aregister 158 of the events routine 20 b. The register 158 maintains theprocess ID 152 and event 154 associated with the child process 156 a.The events routine 20 b maintains the functionality to place the childprocess 156 a, as well as the other child processes 156 b and 156 c,into the wait state upon request by the COBOL program 12.

At the appropriate time, the COBOL program 12 initiates the childprocess 156 a by signaling the events routine 20 b using the process ID152 and the event 154 associated with the desired process, such as thechild process 156 a. In some cases, the COBOL program 12 may only signalthe child process 156 a using the process ID 152, via the events routine20 b. The events routine 20 b receives the process ID 152 from the COBOLprogram 12 and associates the event 154 with the process ID 152 usingthe register 158. The events routine 20 b then signals the appropriatechild process, such as child process 156 a, based on the process ID 152.

The child process 156 a is programmed to perform a process, such asoutputting to a shared resource 56 or writing to memory, for example.The COBOL program 12 and the events routine 20 b, via the index 150 andregister 158, respectively, are operable to maintain a plurality ofprocess IDs 152 and a plurality of events 154 associated with the one ormore child processes 156. The events routine 20 b is operable tocoordinate signaling and processing of the child processes 156 to theshared resource 56.

The shared resource 56 may be, for example, a socket connectioninitially created by the COBOL program 12 via the sockets routine 20 e.In some operating systems, only the process that creates the socketconnection is able to use that connection. In this case, it may beuseful for the COBOL program 12 to pass or assign the socket connectionto the child process 156, for reasons of programming efficiency. Tocoordinate the transfer of, for example, a socket connection requires asynchronized transfer. The events routine 20 b is operable tosynchronize such a transfer. In this example, the COBOL program 12created the shared resource 56 or socket connection and has ownership ofthe socket connection until it is otherwise assigned.

Typically the operating system of a mainframe computer, for example,designates the shared resource 56, or socket connection, to the COBOLprogram 12 based on the process ID of the COBOL program 12. The COBOLprogram 12 gives, via the events routine 20 b, the shared resource 56 tothe child process 156. The COBOL program 12 then enters into an eventwait until receiving a response from the child process 156. The childprocess 156 receives or takes the shared resource 56 from the COBOLprogram 12 and signals the COBOL program 12 that the take has beencompleted. The giving and taking of the shared resource 56, in thismanner, may be accomplished via one or more operating system calls fromthe events routine 20 b to the operating system to transfer the processID designated for the shared resource 56.

Socket connections, as well as other shared resources 56 may betransferred between the creating resource and other subtasks, threads,routines, or subprograms to provide additional functionality to theCOBOL programming language. In the present embodiment, the eventsroutine 20 b is a COBOL program maintained in a library linkable to theCOBOL program 12. Similar to the manner described above, the calls tothe operating system that accomplish the giving and taking of the sharedresource are accomplished by COBOL language program calls to theoperating system. It will be appreciated that, depending upon theparticular operating system where the technical layer 10 is employed,coordination of taking and giving shared resources can be problematicand, if not synchronized properly, can cause errors and systeminstability.

In some other embodiments, the child process 156 signals the COBOLprogram 12, via the events routine 20 b, to signal that the childprocess 156 has received or taken the shared resources. In alternateembodiments, the child process 156 signals the COBOL program 12directly. The events routine 20 b of the technical layer 10 providesadditional functionality to the COBOL language to allow for asynchronousand distributed processing and the coordination of event handling acrossvarious child processes which was not previously available to COBOLdevelopers. This functionality also provides COBOL applications theability to use both semaphores and mutexes in conjunction. For example,the semaphore routine 20 i can be used to process, synchronize, stop,and start across jobs or programs, while the mutex routine 20 j can beused to process synchronize, stop and start across threads within theseprograms.

FIG. 10 is a block diagram of an exemplary system illustrating use ofdistributed and asynchronous processing in COBOL to parallelize anddistribute work. The system 170 is provided only as an exemplaryimplementation of the technical layer 10 using COBOL language programs.Alternative changes, modifications, and techniques may also be employedfor systems requiring different or additional functionality. The system10 includes a first machine 172, a second machine 174, a third machine176 and a fourth machine 178. The machines 172-178 may be computersystems such as mainframe computer systems, mid-range computer systems,networks and/or desktop computer systems.

In the present embodiment, the first through third machines 172-176 aremainframe computer systems and the fourth machine 178 is a mid-rangecomputer system. The second machine 174 is provided with a customerinterface 180 for managing, for example, internet user profiles. Theinformation for the internet user profiles may be stored, for example,in a customer master file or CustMast file (not shown). Accountsreceivable information for the internet user profile may be maintainedin a first A/R file 182 provided on the first machine 172. Additionalaccount receivable information for the internet user profile may bemaintained in a second A/R file 184 maintained on the third machine 176.The first and second A/R files 182 and 184 may also representapplications having access to databases wherein the relevant informationis stored.

A plurality of databases 186 stored on the fourth machine 178 maintain amore detailed record of customer information stored as one or moredatabase files or databases. The customer interface 180 is a COBOLapplication, which may be one or more COBOL programs, routines, orsubroutines enabled via the technical layer 10 for gathering customerdata to be stored in the databases 186 on the fourth machine 178. Thecustomer interface 180 is operable to retrieve customer information forreporting and other purposes, for example, on thousands of customerswhose information is maintained in the customer master file.

The customer interface 180 may be comprised of a plurality of COBOLprograms including a profile changes program 190. The profile changesprogram 190 is operable using the message queue routine 20 h of thetechnical layer 10 to employ a message queue 192. The profile changesprogram 190 using the shared memory routine 20 c is operable toestablish a shared memory 194 on the second machine 174. To quickly andefficiently read thousands of records from the customer master file, theprofile changes program 190 is operable, using the technical layer 10,to spawn a plurality of jobs 196 designated alphanumerically 196 a, 196b, and 196 c. Processing the separate jobs 196 may be accomplished, forexample, using the semaphore routine 20 i, as described above. In thismanner, the profile changes program 190 breaks up access to the customermaster file into multiple jobs to improve the efficiency of accessingthe customer master information.

Each of the jobs 196 operates in its own address space, but is able toshare the shared memory 194. As each of the jobs 196 is started, thejobs 196 look at the shared memory 194 to obtain the key with thelocation to the message queue 192, such as elsewhere in memory. The jobs196 then take the first message off the message queue 192 and processthe message or instruction. The job 196 then, for example, pulls orreads records off the customer master file and puts or writes theinformation to an output queue 198. The profile changes program 190, viathe technical layer 10, is operable to monitor and manage the messagequeue 192 to provide the jobs 196 with messages or work. The sharedmemory 196 is used to communicate across the jobs 196 any information tobe shared between the jobs 196.

An A/R changes program 200 is a COBOL program or routine that isoperable to read information from the output queue 198 as written fromthe jobs 196. The A/R changes program 200 may be a program or routinethat is part of the customer interface 180. The A/R changes program 200,in this example, requires information from the first and second A/Rfiles 182 and 184 to complete processing. Rather than route jobsone-at-a-time and waiting until the process is returned, the A/R changesprogram 200 is operable, using the technical layer 10, to do a socketconnection request directly to the relevant A/R customer data.Specifically, the A/R changes program 200, using the sockets routine 20e, is operable to enable socket communication to the first A/R file 182on the first machine 172 and further operable to retrieve informationfrom the second A/R file 184 on the third machine 176 via a socketrequest.

The A/R changes program 200 combines the information from the outputqueue 198 received from the jobs 196 with the associated data from thefirst and second A/R files, received via the socket connections. The A/Rchanges program 200 then outputs the combined information or data toprogram 202 or system on the fourth machine 178, via an additionalsocket communication. The output to the fourth machine 178 may beperformed using, among other functions, the semaphore routine 20 i. Theprogram 202 is operable to appropriately divide and store the data intothe databases 186.

The system 170 illustrated in FIG. 10 is an example of the functionalitythat the technical layer 10 provides to COBOL language programmers toenable asynchronous and distributed processing. Although the system 170does not specifically employ all the routines 20 of the technical layer10, the system 170 is illustrated to provide insight into the vast newcapabilities enabled for the COBOL language by the present disclosure.While the technical layer 10 is used as a library in this example, theasynchronous and distributed COBOL functions disclosed herein, aspreviously discussed, may also be enabled via a pre-compiler, acompiler, or by directly programming the system 170 for thisfunctionality.

While several embodiments have been provided in the present disclosure,it should be understood that the implementation of distributed andasynchronous processing in COBOL may be embodied in many other specificforms without departing from the spirit or scope of the presentdisclosure. The present examples are to be considered as illustrativeand not restrictive, and the intention is not to be limited to thedetails given herein, but may be modified within the scope of theappended claims along with their full scope of equivalents. For example,the various elements or components may be combined or integrated inanother system or certain features may be omitted, or not implemented.

Also, techniques, systems, subsystems and methods described andillustrated in the various embodiments as discrete or separate may becombined or integrated with other systems, modules, techniques, ormethods without departing from the scope of the present disclosure.Other items shown as directly coupled or communicating with each othermay be coupled through some interface or device, such that the items mayno longer be considered directly coupled to each but may still beindirectly coupled and in communication with one another. Other examplesof changes, substitutions, and alterations are ascertainable by onskilled in the art and could be made without departing from the spiritand scope disclosed herein.

1. A system for enabling socket communication in COBOL program,comprising: a memory block; a COBOL program communicating with thememory block; a socket; and a COBOL routine callable from the COBOLprogram, the COBOL routine operable to read information from the socketand write the information read from the socket to the memory block inresponse to the COBOL program call.
 2. The system of claim 1, whereinthe COBOL program further communicates with the COBOL routine toinitiate the COBOL routine communication with the socket and the memoryblock.
 3. The system of claim 1, wherein the COBOL routine is furtherdefined as a subroutine of the COBOL program.
 4. The system of claim 1,wherein the COBOL routine is further defined as a COBOL library having aplurality of routines callable by the COBOL program.
 5. The system ofclaim 1, wherein the COBOL routine is further defined as a compilerenabled function usable by the COBOL program.
 6. Method for enablingsocket communication in COBOL program, comprising: requesting, by aCOBOL program, information from a socket; retrieving, by a COBOLroutine, information from the socket; writing, by the COBOL routine,information read from the socket to a memory block; and reading from thememory block, by the COBOL program, the information.
 7. The method ofclaim 6, wherein the method further comprises managing, by the COBOLroutine, a connection with the socket.
 8. The method of claim 7, whereinmanaging includes listening on the socket connection.
 9. The method ofclaim 7, wherein managing includes disconnecting the connection with thesocket.
 10. The method of claim 6, wherein the method further comprises,establishing, by the COBOL routine, a connection with the socket. 11.The method of claim 10, wherein the connection with the socket isestablished in response to a request from the COBOL program
 12. Themethod of claim 6, wherein the COBOL routine provides an address to theCOBOL program, the address identifying a location of the memory blockwhere the information is written.
 13. The method of claim 12, whereinthe method further comprises mapping, by the COBOL program, the memoryblock into the COBOL program.
 14. The method of claim 13, wherein themapping is accomplished using a copybook.
 15. The method of claim 6,wherein the information is provided in an EBCDIC format and wherein themethod further comprises converting the information from the EBCDICformat to an ASCII format.
 16. The method of claim 15, wherein theconversion is accomplished by the COBOL routine.
 17. The method of claim6, wherein the COBOL routine further includes a coordination module tocoordinate such that the COBOL routine only reads when the socket hasinformation and only writes when the socket is not full.
 18. The methodof claim 6, further comprising initiating a call to the operating systemby the COBOL routine to establish a socket connection.
 19. The method ofclaim 18, wherein the call to the operating system is further defined asa bit-level call to the operation system of a mainframe computer system.20. The method of claim 19, wherein the COBOL routine is further definedas written in COBOL programming language.
 21. A system for enabling pipecommunication in COBOL program, comprising: a memory block; a COBOLprogram communicating with the memory block; a pipe; and a COBOL routinecallable from the COBOL program, the COBOL routine operable to readinformation from the pipe and write the information read from the pipeto the memory block in response to the COBOL program call.
 22. Thesystem of claim 21, wherein the memory block is further defined as amainframe memory block and wherein the COBOL program and COBOL routineare operable on a mainframe computer system.
 23. The system of claim 22,wherein the COBOL routine is further defined as a COBOL technical layerhaving a plurality of routines callable by the COBOL program, the COBOLtechnical layer including: a create module communicating with a computersystem and operable to create a pipe connection; a connect moduleoperable to promote attachment to the pipe connection; an open moduleoperable to open the pipe connection to promote communication via thepipe connection; a write module operable to write information to thepipe connection, the write module operable to verify that the pipeconnection is not full prior to writing information and further operableto block when the pipe connection is full; a read module coupleable tothe pipe connection to read information from the pipe connection; arelease module to release the pipe connection; a remove module to removethe pipe connection from the computer system; and a delete module todelete the pipe connection wherein the pipe connection is closed.
 24. Amethod for socket communication in COBOL, comprising: reading, by aroutine, information from a socket; writing, by the routine, theinformation to an area; and reading, by a COBOL program, the informationfrom the area, the COBOL program and the routine operating in the sameruntime environment.
 25. The method of claim 24, wherein the area is afile.
 26. The method of claim 24, wherein the area is a memory area.